<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
</head>
<body>
  <h1>jsonp方式发送ajax跨域请求</h1>
  <h1>127.0.0.1:8888/getData</h1>
  <script>
    $.ajax({
      url:"http://127.0.0.1:8888/getData",
      type:"get",
      dataType:"jsonp",
      data:"",
      jsonp:"callback",
      success:function(data){
        console.log(data);
      },
    });
  </script>
</body>
</html>